/*
 * @Descripttion: 
 * @version: 
 * @Author: TT
 * @Date: 2023-08-25 17:33:32
 * @LastEditors: TT
 * @LastEditTime: 2023-10-30 15:13:19
 */

import 'package:flutter/material.dart';
import 'package:hzy_project_template/base_ui_config/base_ui_config_index.dart';
import 'package:hzy_project_template/config/config_index.dart';
import 'package:hzy_project_template/models/models_index.dart';
import 'package:hzy_project_template/pages/login/vm/login_vm.dart';

import '../widgets/login_child_widget.dart';

import '../config/note_login_config.dart';

class NoteRegisterV extends CommonGetXV<NoteRegisterC> {
  NoteRegisterV({Key? key}) : super(key: key);
  @override
  NoteRegisterC get controller => Get.put(NoteRegisterC());

  @override
  Widget createBody({
    required BuildContext context,
    BoxConstraints? constraints,
  }) {
    Widget body = LoginChildWidget(
      config: controller.config,
      tapCallback: (imageModel) {
        controller.tapDo(
          imageNormalModel: imageModel,
        );
      },
    );
    return body;
  }
}

class NoteRegisterC extends CommonGetXController {
  // --------- 属性 --------- //

  NoteLoginConfig config = NoteLoginConfig(
    nickNameType: 3,
    inputStype: 3,
    bottomType: 3,
    isCanTap: false,
  );

  LoginVM vm = LoginVM();
  // --------- 生命周期  --------- //
  @override
  configDefault() {
    configNormalData();
    isShowAppBar = false;
    safeAreatop = false;
    scallBackGroundColor = Colors.white;
    safeAreabottm = true;
  }

  // --------- 数据处理  --------- //

  /// 配置默认数据
  configNormalData() {}
  // --------- 触发事件  --------- //

  tapUserImg() {}

  tapDo({
    ImageNormalModel? imageNormalModel,
  }) {
    vm.configRegister(
      account: config.accountInputModel.text!,
      nickName: config.nickNameInputModel.text!,
      pwd: config.nickNameInputModel.text!,
      imageNormalModel: imageNormalModel,
    );
  }
}
